package com.dsa.utils;

import lombok.SneakyThrows;

import java.util.List;
import java.util.concurrent.TimeUnit;

public class Utils {


    @SneakyThrows
    public static void sleep(long millis) {
        TimeUnit.MILLISECONDS.sleep(millis);
    }

    public static <E> void swap(E[] array, int i, int j) {
        E temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    }

    public static <E> void swap(List<E> list, int i, int j) {
        E temp = list.get(i);
        list.set(i, list.get(j));
        list.set(j, temp);
    }
}
